<!-- 搜索列表 -->
<template>
	<lilo-form-table ref="formTable" :query-info="queryInfo" :form-data="formData" :table-data="tableData"></lilo-form-table>
</template>

<script>
import { GetCC_MBXList } from '@/api/ccxt/ccmbgl/index.js';
import variables from '@/styles/variables.scss';

export default {
	computed: {
		variables() {
			return variables;
		}
	},
	data() {
		return {
			queryInfo: {
				entity: GetCC_MBXList,
				param: {
					PageNo: 1,
					PageSize: 15
				},
				requestField: {
					index: 'PageNo', //页码字段名，必须和param里面的字段名对应
					size: 'PageSize' //页数字段名，必须和param里面的字段名对应
				},
				responseField: {
					data: 'list', //返回的数据列表字段名
					total: 'total' //返回的数据列表总条数字段名
				}
			},
			formData: {
				dataProvider: {
					SearchValue: ''
				},
				rules: {},
				templates: [
					{
						layout: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24 },
						component: {
							name: 'Divider',
							label: '条件搜索'
						}
					},
					{
						layout: { xs: 24, sm: 24, md: 4, lg: 4, xl: 4 },
						field: 'SearchValue',
						component: {
							name: 'Input',
							placeholder: '请输入',
							clearable: true
						}
					},
					{
						layout: { xs: 24, sm: 24, md: 8, lg: 8, xl: 8 },
						component: {
							name: 'Template',
							templates: [
								{
									name: 'Button',
									label: '查询',
									type: 'primary',
									icon: 'el-icon-search',
									click: this.query
								},
								{
									name: 'Button',
									label: '重置',
									icon: 'el-icon-refresh-right',
									click: this.reset
								}
							]
						}
					}
				]
			},
			tableData: {
				autoHeight: true, //是否自动计算table高度，默认为true
				deltaHeight: 145, //table的高度微调，配合自动计算高度使用，默认值为145
				//特殊情况下可以设置autoHeight为false，根据屏幕高度手动调整deltaHeight，支持Function挥着Number
				// autoHeight: false, //是否自动计算table高度，默认为true
				// deltaHeight: () => { //除开table之外的高度
				// 	if(this.$store.getters.outerPageLoad) {
				// 		return 291; //外部调用，没有系统头部
				// 	} else {
				// 		return 345; //内部菜单，正常调用
				// 	}
				// },
				dataProvider: {
					tablelist: []
				},
				templates: [
					{
						layout: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24 },
						component: {
							name: 'Divider',
							label: '抽查项列表',
							info: '测试文本信息',
							templates: [
								{
									name: 'Button',
									label: '添加',
									type: 'primary',
									// icon: 'el-icon-search',
									round: false,
									click: this.templateDividerAdd
								}
							]
						}
					},
					{
						layout: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24 },
						field: 'tablelist',
						// label: '核酸检测机构名称',
						labelWidth: '0px',
						component: {
							name: 'Table',
							// height: 200, //如果手动设置table高度需要autoHeight=false
							columns: [
								{
									field: 'ccmc',
									label: '抽查项名称'
								},
								{
									field: 'jkf',
									label: '加扣分分值',
									width: 150
								},
								{
									field: 'cjsj',
									label: '采集时间',
									width: 150
								},
								{
									label: '操作',
									width: 160,
									fixed: 'right',
									templates: [
										{
											name: 'Button',
											label: '编辑',
											type: 'primary',
											// icon: 'el-icon-search',
											click: this.editHandler
										},
										{
											name: 'Button',
											label: '删除',
											type: 'danger',
											// icon: 'el-icon-search',
											click: this.delHandler
										}
									]
								}
							]
						}
					}
				]
			}
		};
	},
	methods: {
		templateDividerAdd(item, template) {
			console.log(item);
			console.log(template);
		},
		query() {
			this.$refs.formTable.query();
		},
		reset() {
			this.$refs.formTable.reset();
		},
		editHandler(row) {
			console.log(row);
		},
		delHandler(row) {
			console.log(row);
		}
	}
};
</script>

<style></style>
